<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>LzCMS-后台管理中心</title>
    <link rel="stylesheet" href="/weixinapp/public/layui/layui/css/layui.css">
    <link rel="stylesheet" href="/weixinapp/public/css/global.css">
    <script type="text/javascript" src="/weixinapp/public/layui/layui/layui.js"></script>
</head>
<body>
<style type="text/css">html{background: #f3f3f3;}</style>
<div class="login_page">
   <img class="logo-login" src="/weixinapp/public/img/logo-login.png" alt="logo">
    <h1>欢迎使用 Lz</h1>
    <form class="layui-form" method="post">
        <div class="layui-form-item">
            <div class="layui-input-inline input-custom-width">
                <input type="text" name="username" lay-verify="required" placeholder="用户名" autocomplete="off" class="layui-input" id="username">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-inline input-custom-width">
                <input type="password" name="password" lay-verify="required" placeholder="密码" autocomplete="off" class="layui-input" id="password">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-inline input-custom-width">
              <button class="layui-btn input-custom-width" lay-submit="" lay-filter="login">立即登陆</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">

layui.use(['form','jquery'],function(){
    var form = layui.form
    ,$ = layui.jquery;

    //监听提交
      form.on('submit(login)', function(data){
          var username = $('#username').val();
          var password = $('#password').val();
          console.log(username);
          console.log(password);
	      $.ajax({
	        url:"/weixinapp/public/index.php/admin/login/dologin",
	        type:'post',
	        data:{'username':username,'password':password},
	        dataType:'json',
	        success:function(data){
	           if(data.code == 200){
               layer.msg(data.msg, {icon:1,time:1000},function(){
               location.href = 'admin/index';
            });
          }else{
          	layer.msg(data.msg,{icon:2,time:1000},function(){
          		window.location.reload();
          	});
          }
	        }
	      })
        return false;
      });
});
</script>
</body>
</html>